package com.homework.action;

import java.util.Map;

import com.homework.bean.UserBean;
import com.homework.service.UserService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class GetUserInfoAction extends ActionSupport{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	UserBean userBean = null;
	UserService userService = new UserService();
	
	public String execute(){
		Map<String, Object> session = ActionContext.getContext().getSession();
		Object userId = session.get("userId");
		if(userId == null){
			//返回找不到用户
			return ERROR;
		}
		userBean = userService.getUserInfo(userId.toString());
		return SUCCESS;
	}

	public UserBean getUserBean() {
		return userBean;
	}

	public void setUserBean(UserBean userBean) {
		this.userBean = userBean;
	}
}
